////////////////////////////////////////////////////////////////////////////
//
// GUI_Structures.h
//
// This file contains the definitions and data structures used by GUI
//
// 10/31/02' initial version
// 7/15/03' modified by PD50(version wb32mmi_0611)  
////////////////////////////////////////////////////////////////////////////

#ifndef _GUI_Structures_H_
#define _GUI_Structures_H_

// Some miscellaneous definitions
#define   MAC_ADDR_LENGTH               6
#define   MAX_CHANNELS                  30
#define   GUI_MAX_BSS_DESCRIPTIONS      24

// Define BSSType
#define   GUI_INFRASTRUCTURE            0
#define   GUI_INDEPENDENT               1
#define   GUI_ANY_BSS                   2

#ifdef _OLD_SW_MAC_
// Define STAState
#define  GUI_BSS_STATE_NOSCAN           0
#define  GUI_BSS_STATE_SCANNING         1
#define  GUI_BSS_STATE_IN_JOIN          2
#define  GUI_BSS_STATE_BSS              3
#define  GUI_BSS_STATE_AUTHEN           4
#define  GUI_BSS_STATE_ASSOC            5
#define  GUI_BSS_STATE_IBSS             6

#else
//state of SME module
#define DISABLED						0
#define INIT_SCAN						1
#define SCAN_READY						2
#define START_IBSS						3
#define JOIN_PENDING					4
#define JOIN_CFM						5
#define AUTHENTICATE_PENDING			6
#define AUTHENTICATED					7
#define CONNECTED						8
//#define EAP_STARTING					9
//#define EAPOL_AUTHEN_PENDING			10
//#define SECURE_CONNECTED				11

#endif

// Define scan type
#define  GUI_ST_ACTIVE                  0
#define  GUI_ST_PASSIVE                 1

// Define TxRate
#define  GUI_TXRATE_1M                  0
//#define  GUI_TXRATE_0M                1
#define  GUI_TXRATE_2MLONG              2
#define  GUI_TXRATE_2MSHORT             3
#define  GUI_TXRATE_55MLONG             4
#define  GUI_TXRATE_55MSHORT            5
#define  GUI_TXRATE_11MLONG             6
#define  GUI_TXRATE_11MSHORT            7
#define  GUI_TXRATE_AUTO                255

// Define Basic Tx Rate Set
#define  GUI_BASIC_TXRATE_1M                0x82
#define  GUI_BASIC_TXRATE_2M                0x84
#define  GUI_BASIC_TXRATE_5_5M              0x8b
#define  GUI_BASIC_TXRATE_11M               0X96

#define  GUI_OPERATION_TXRATE_1M                0x2
#define  GUI_OPERATION_TXRATE_2M                0x4
#define  GUI_OPERATION_TXRATE_5_5M              0xb
#define  GUI_OPERATION_TXRATE_11M               0x16

// Define Extended supported rates Set for 802.11g
#define  GUI_EXTENDED_TXRATE_22M             0x2c
#define  GUI_EXTENDED_TXRATE_33M             0x42
#define  GUI_EXTENDED_TXRATE_6M              0x0c
#define  GUI_EXTENDED_TXRATE_9M              0x12
#define  GUI_EXTENDED_TXRATE_12M             0x18
#define  GUI_EXTENDED_TXRATE_18M             0x24
#define  GUI_EXTENDED_TXRATE_24M             0x30
#define  GUI_EXTENDED_TXRATE_36M             0x48
#define  GUI_EXTENDED_TXRATE_48M             0x60
#define  GUI_EXTENDED_TXRATE_54M             0x6c

// select tx rate automatically
#define GUI_ALL_TXRATE                     0x00


//New added for b+g
#define GUI_MODE_802_11_BG			0
#define GUI_MODE_802_11_A			1
#define GUI_MODE_802_11_ABG			2
#define GUI_MODE_802_11_BG_IBSS		3

typedef struct _GUIScanPara
{
  BYTE       BSSType;
  BYTE       BSSID[MAC_ADDR_LENGTH];
  BYTE       SSID[33];                  // 0x00 as terminated
  BYTE       ScanType;
  WORD       ProbeDelay;
  BYTE       ChannelList[MAX_CHANNELS];
  WORD       MinChannelTime;
  WORD       MaxChannelTime;
  BOOL      boUseFastScanOption;

} GUIScanPara, *psGUIScanPara;

typedef struct _GUIBssDescriptElement
{
   BYTE      Timestamp[8];              // 8 octets
   WORD      Beacon_Period;             // 2 octets
   WORD      CapabilityInformation;     // 2 octets
   BYTE      BSSID[MAC_ADDR_LENGTH];
   BYTE      SSID[33];                  // 0x00 as terminated
   BYTE      BSSType;
   BYTE      DTIM_Period;               // 1 octet
   BYTE      Local_Time[8];             // 8 octets
   WORD      CFP_MaxDuration;           // in Time Units
   WORD      ATIM_Window;               // IBSS_Parameter_Set_Element
   BYTE      BSSBasicRateSet[9];        // end with zero
   BYTE      Current_Channel;           // DS_Parameter_Set_Element
   DWORD	 Rssi;						// RSSI information. -10(Good) ~ -200(Bad)
} GUIBssDescriptElement, *psGUIBssDescriptElement;

typedef struct _GUIBssList
{
   WORD      NumberOfItems;
   GUIBssDescriptElement BSS[GUI_MAX_BSS_DESCRIPTIONS];

} GUIBssList, *psGUIBssList;

/*
typedef struct _GUIStartPara
{
  BYTE       SSID[33];                  // 0x00 as terminated
  WORD       BeaconPeriod;
  BYTE       Current_Channel;           // DS_Parameter_Set_Element
  WORD       ATIM_Window;               // IBSS_Parameter_Set_Element
  BYTE       BSSBasicRateSet[9];        // end with \x00
  BYTE       OperationalRateSet[9];     // End with \x00

} GUIStartPara, *psGUIStartPara;
*/

// Expend rate set for 802.11g
#define MAX_BASIC_RATE_SET          15
#define MAX_OPT_RATE_SET            MAX_BASIC_RATE_SET
typedef struct _GUIStartPara
{
  BYTE       SSID[33];                  // 0x00 as terminated
  WORD       BeaconPeriod;
  BYTE       Current_Channel;           // DS_Parameter_Set_Element
  WORD       ATIM_Window;               // IBSS_Parameter_Set_Element
  BYTE       BSSBasicRateSet   [MAX_BASIC_RATE_SET];   // end with \x00
  BYTE       OperationalRateSet[MAX_OPT_RATE_SET];     

} GUIStartPara, *psGUIStartPara;


struct Reason_Code
{
  BYTE       PeerSTAAddr[MAC_ADDR_LENGTH];
  WORD       ReasonCode;
};

typedef struct AuthenReq_Parameter
{
  BYTE       PeerSTAAddr[MAC_ADDR_LENGTH];
  BYTE       AuthenType;
  DWORD      AuthenFailTimeOut;         // TU

} GUIAuthenReqPara, *psGUIAuthenReqPara;

// AuthenType
#define AUTH_OPEN_SYSTEM		0
#define AUTH_SHARED_KEY			1

typedef struct Reason_Code GUIDeAuthenReqPara, *psGUIDeAuthenReqPara;

/*
typedef struct AssocReq_Parameter
{
  BYTE       PeerSTAAddr[MAC_ADDR_LENGTH];
  WORD       AssocFailTimeOut;              // TU
  WORD       CapabilityInfo;
  WORD       ListenInterval;                // no. of beacon intervals

} GUIAssocReqPara, *psGUIAssocReqPara;
*/


// PD500611 chequer add
typedef struct AssocReq_Parameter
{
  BYTE       PeerSTAAddr[MAC_ADDR_LENGTH];
  WORD       AssocFailTimeOut;              // TU
  WORD       CapabilityInfo;
  WORD       ListenInterval;                // no. of beacon intervals
  BYTE       BasicRateSet      [MAX_BASIC_RATE_SET];   // end with \x00
  BYTE       OperationalRateSet[MAX_OPT_RATE_SET];

} GUIAssocReqPara, *psGUIAssocReqPara;

/*
typedef struct ReAssocReq_Parameter
{
  BYTE       NewAPAddr[MAC_ADDR_LENGTH];
  WORD       ReAssocFailTimeOut;            // TU
  WORD       CapabilityInfo;
  WORD       ListenInterval;                // no. of beacon intervals

} GUIReAssocReqPara, *psGUIReAssocReqPara;
*/

typedef struct ReAssocReq_Parameter
{
  BYTE       NewAPAddr[MAC_ADDR_LENGTH];
  WORD       ReAssocFailTimeOut;            // TU
  WORD       CapabilityInfo;
  WORD       ListenInterval;                // no. of beacon intervals
  BYTE       BasicRateSet      [MAX_BASIC_RATE_SET];   // end with \x00
  BYTE       OperationalRateSet[MAX_OPT_RATE_SET];

} GUIReAssocReqPara, *psGUIReAssocReqPara;


typedef struct Reason_Code GUIDisAssocReqPara, *psGUIDisAssocReqPara;

typedef WORD GUI_FRAG_THRSHLD,GUI_RTS_THRSHLD;

typedef BYTE GUIWEPMode;                    // disable/64 bits/128 bits
#define WEP_DISABLE     0                   // Default
#define WEP_KEY_64		1
#define	WEP_KEY_128		2

typedef struct _GUIWEPPara
{
  BYTE        KeyIndex;             // 0,1,2,3 for shared-key, 0x80 for map-key
  BYTE        KeyValue[13];         // length depend on KEY_64 or KEY_128
  BYTE        MACAddr[MAC_ADDR_LENGTH]; // = NULL if KeyIndex!=0x80

} GUIWEPPara, *psGUIWEPPara;

typedef struct _GUIStatistics
{
  DWORD         NumTxMMPDU;
  DWORD         NumTxMMPDUDiscarded;
  DWORD         NumRxMMPDU;
  DWORD         NumRxMMPDUDiscarded;
  DWORD         NumTxMSDU;
  DWORD         NumRxMSDU;
  DWORD         NumFrameDuplicate;
  DWORD			NumTxTBTTstart;
  DWORD			NumTxETR;
  DWORD			NumTxWepOnFalse;
  DWORD			NumTxNullKey;
  DWORD			NumTxRetry[8];
} GUIStatistics, *psGUIStatistics;

typedef struct _GUIRegAccess
{
  BYTE          RegNo;
  DWORD         dwValue;
} GUIRegAccess, *psGUIRegAccess;

#define WEP_MAP_KEY		0x80

typedef BYTE GUIRoamingMode;
#define ROAMING_DISABLED    0
#define ROAMING_ENABLED     1

//-----------  06/28/04'  ----------------
typedef struct _AdvanceStatus
{
	BYTE		OperationMode;
	BYTE		ProtectionMode;	//BOOLEAN
	BYTE		PreambleType;	//BOOLEAN: 1(short), 0(long)
	BYTE		SlotTimeType;	//BOOLEAN: 1(short), 0(long)
	BYTE		CWMinValue;
	//12/06/04' added
	BYTE		AntennaType;	//0 or 1
	WORD		CWMaxValue;
}GUIAdvanceStatus, *psGUIAdvanceStatus;


//--------- DTO threshold parameters -------------
typedef struct _DTOPara
{
	WORD	DTO_PeriodicCheckCycle;
	WORD	DTO_RssiThForAntDiv;
	WORD	DTO_TxCountThForCalcNewRate;
	WORD 	DTO_TxRateIncThreshold;
	WORD 	DTO_TxRateDecThreshold;
	WORD 	DTO_TxRateEqThreshold;
	WORD	DTO_TxRateBackoff;
	WORD	DTO_TxRetryRateReduce;
	WORD	DTO_TxPowerIndex;
}GUIDtoPara, *psGUIDtoPara;

typedef struct _EVENT_LOG
{
	WORD		Count;			//Total count from start
	WORD		index;			//Buffer index, 0 ~ 63
	DWORD		EventValue[64];	//BYTE 3~2 : count, BYTE 1 : Event, BYTE 0 : reason
} GUIEvent_Log, *psGUIEvent_Log;


#endif // GUI_structures


